package giermala.dominik.fotka.dao;

import giermala.dominik.fotka.domain.User;

import javax.persistence.Query;

import org.springframework.stereotype.Repository;

@Repository
public class UserDao extends AbstractJpaDao<User> implements IUserDao {

	public UserDao(){
	      setClazz(User.class );
	}

	public User findByName(String username) {
		Query query = entityManager.createQuery("from User u where u.username like :username");
		query.setParameter("username", username);
		User user = (User)query.getSingleResult();
		return user;
	}
	
	
}
